Skip to content

feat(contract-document): take an employmentId and load the contractor - #1327

Merged
jordividaller merged 7 commits into
mainfrom
feat/pbyr-4777-contract-document-employment-id
Sep 17, 2026
Merged

jordividaller merged 7 commits into
mainfrom
feat/pbyr-4777-contract-document-employment-id

Conversation

@jordividaller

@jordividaller jordividaller commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Second part of the standalone ContractDocument flow (pbyr-4777), after #1319.

  • employmentId is now required by ContractDocumentFlow and useContractDocument, as for Invoice Schedule: no contractor picker in the library
  • the hook loads the employment and the contractor's existing contract documents, and exposes employmentId, employment, isContractorOfRecord, contractDocuments on the bag; isLoading stays true while the id is empty or a request is in flight, and nothing is requested for an empty id
  • useGetContractDocuments moves to src/common/contract-documents/ (own commit, re-exported at the old path) on a contractDocumentsOptions factory
  • the three demos that ask for an Employment ID (Termination, Invoice Schedule, Contract Document) share one EmploymentIdForm
  • client regenerated from the production gateway (own commit, mechanical)

Nothing is rendered from the loaded data yet. Next PR: the contract details form, built from GET /v1/countries/{code}/contractor-contract-details?employment_id=…, whose schema now carries the prefill as default values.

🤖 Generated with Claude Code


Note

Low Risk
Mostly example/demo UX and regenerated client typings; consumers of removed engagement-agreement-details client exports may need to migrate to the v2 employment endpoint.

Overview
Contract document flow now requires a caller-supplied employmentId (same pattern as invoice schedule): useContractDocument loads that employment and existing contract documents and exposes them on the render bag; loading stays true until an id is set and requests finish. The contract-document example gates on a shared EmploymentIdForm before mounting the flow and shows a minimal header (contractor name, Contractor of Record label).

Example apps deduplicate employment-ID entry: Termination, Invoice Schedule, and Contract Document replace bespoke forms with EmploymentIdForm (env-based defaults and custom submit labels unchanged).

Generated API client is refreshed from the gateway: adds Projects list/get/patch and POST …/job-title-eligibility-check, drops GET /v1/countries/{code}/engagement-agreement-details and related exports, plus assorted new types (e.g. PayItemProviderDataParams).

Reviewed by Cursor Bugbot for commit 42b9b5f. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 283.23 kB 282.54 kB +684 B (+0.2%) 🔴
Total (raw) 747.56 kB 746.1 kB +1.46 kB (+0.2%) 🔴
CSS (gzip) 21.93 kB 21.93 kB 0 B (0%) 🟢
CSS (raw) 113.97 kB 113.97 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 283.23 kB / 350 kB (80.9%)
  • ✅ Total raw: 747.56 kB / 850 kB (87.9%)
  • ✅ CSS gzipped: 21.93 kB / 25 kB (87.7%)

Largest Files (Top 5)

  1. chunk-SRLBVFNQ.js - 12.94 kB (0 B (0%))
  2. styles.css - 10.97 kB (0 B (0%))
  3. index.css - 10.97 kB (0 B (0%))
  4. index.js - 7.17 kB (+5 B (+0.1%))
  5. chunk-FPCF4TH2.js - 6.58 kB (new)
View All Files (471 total)
File Size (gzip) Change
chunk-SRLBVFNQ.js 12.94 kB 0 B (0%)
styles.css 10.97 kB 0 B (0%)
index.css 10.97 kB 0 B (0%)
index.js 7.17 kB +5 B (+0.1%)
chunk-FPCF4TH2.js 6.58 kB new
chunk-INRYXESS.js 6.46 kB new
chunk-J23IEAZ2.js 5.88 kB new
chunk-C4HFMTSB.js 5.33 kB 0 B (0%)
chunk-JNPESWI7.js 4.69 kB new
chunk-GIQIO4GI.js 4.38 kB new

✅ Bundle size check passed

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 86.19% 86.16% +0.03% 🟢
Statements 85.77% 85.74% +0.03% 🟢
Functions 84.73% 84.71% +0.02% 🟢
Branches 77.56% 77.52% +0.04% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 4774 / 5539
  • Coverage: 86.19%
  • Change: +0.03% (11 lines)
Statements Coverage
  • Covered: 4857 / 5663
  • Coverage: 85.77%
  • Change: +0.03% (11 statements)
Functions Coverage
  • Covered: 1276 / 1506
  • Coverage: 84.73%
  • Change: +0.02% (2 functions)
Branches Coverage
  • Covered: 2945 / 3797
  • Coverage: 77.56%
  • Change: +0.04% (7 branches)

✅ Coverage check passed

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-qnw600d5q-remotecom.vercel.app
Latest Commit:42b9b5f

Deployed with vercel-action

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 575ba02. Configure here.

Comment thread src/common/contract-documents/api.ts Resolved
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-kp9dkre40-remotecom.vercel.app
Latest Commit:42b9b5f

Deployed with vercel-action

Jordi Vidaller and others added 6 commits September 17, 2026 09:57
Picks up the projects endpoints and the v2 job-title eligibility check, and drops the
removed GET engagement-agreement-details schema, which nothing in the SDK used.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…mmon

`useGetContractDocuments` moves out of ContractorOnboarding so the standalone
ContractDocument flow can share it, built on a `contractDocumentsOptions` factory.
Same query key, same select; the old import path re-exports it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`employmentId` is now required by `ContractDocumentFlow` and `useContractDocument`, as it
is for Invoice Schedule: consumers already know which contractor they act on, so the
library ships no picker.

The hook loads the employment and the contractor's existing contract documents and puts
`employmentId`, `employment`, `isContractorOfRecord` and `contractDocuments` on the bag.
`isLoading` stays true while the id is empty or either request is in flight, and nothing
is requested for an empty id. Neither is rendered yet.

A default MSW handler answers the contract-documents list with an empty list, so the
onboarding tests that reach it behave as before.

Part of pbyr-4777.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Termination, Invoice Schedule and the new Contract Document demo asked for an employment
id with the same markup. One `EmploymentIdForm` now serves the three; labels and ids are
unchanged so the E2E specs keep finding them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… response

The hey-api client does not throw on an error response, so a failed
GET /v1/employments/{id}/contract-documents resolved as a success and, through the `?? []`
select, read as "this contractor has no documents". The factory now throws on
`response.error`, as `countriesOptions` does, with `retry: false` like the employment
query, and `contractDocuments` stays `undefined` when the load failed.

Also: the WIP note in the README says the flow's props and bag may change between minor
versions until it is complete, the fixture carries `updated_at`, and the Termination demo
ignores an empty employment id like the other two demos.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Comment thread src/index.tsx Resolved
Comment thread src/flows/ContractorOnboarding/api.ts Resolved
Comment thread example/src/InvoiceSchedule.tsx Resolved
…from common directly

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jordividaller
jordividaller merged commit 9822e8f into main Sep 17, 2026
13 checks passed
@jordividaller
jordividaller deleted the feat/pbyr-4777-contract-document-employment-id branch September 17, 2026 12:20
@gabrielseco gabrielseco mentioned this pull request Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants